*Theft - analysis - FINAL version
*This is the page for graphs and appendix in the paper

use theft_sec6_long, clear

gen akatiya_bkatiya = 0
replace akatiya_bkatiya = 1 if a_katiya==1 & b_katiya==1
gen akatiya_bfamily = 0
replace akatiya_bfamily = 1 if a_katiya==1 & b_family==1
gen akatiya_bstrange = 0
replace akatiya_bstrange = 1 if a_katiya==1 & b_strange==1


gen afamily_bkatiya = 0
replace afamily_bkatiya = 1 if a_family==1 & b_katiya==1
gen afamily_bfamily = 0
replace afamily_bfamily = 1 if a_family==1 & b_family==1
gen afamily_bstrange = 0
replace afamily_bstrange = 1 if a_family==1 & b_strange==1

gen astrange_bkatiya = 0
replace astrange_bkatiya = 1 if a_strange==1 & b_katiya==1
gen astrange_bfamily = 0
replace astrange_bfamily = 1 if a_strange==1 & b_family==1
gen astrange_bstrange = 0
replace astrange_bstrange = 1 if a_strange==1 & b_strange==1

label var akatiya_bkatiya "A = Katiya, B=Katiya"
label var akatiya_bfamily "A = Katiya, B=Family"
label var akatiya_bstrange "A = Katiya, B=Strangers"

label var afamily_bkatiya "A = Family, B=Katiya"
label var afamily_bfamily "A = Family, B=Family"
label var afamily_bstrange "A = Family, B=Strangers"

label var astrange_bkatiya "A = Strangers, B=Katiya"
label var astrange_bfamily "A = Strangers, B=Family"
label var astrange_bstrange "A = Strangers, B=Strangers"



 foreach x of varlist  akatiya_bfamily-astrange_bstrange  {
gen `x'_income = `x' * income_diff2
gen `x'_elec = `x' * elec_diff2
gen `x'_dalit = `x' * a_dalit
gen `x'_religion = `x' * religion_sim_a
 
 }
 
label var akatiya_bfamily_income "A = Katiya, B= Family * $\Delta$ Income"
label var akatiya_bstrange_income "A = Katiya, B= Strangers * $\Delta$ Income "

label var afamily_bkatiya_income "A =  Family, B=Katiya * $\Delta$ Income "
label var afamily_bfamily_income "A =  Family, B= Family * $\Delta$ Income "
label var afamily_bstrange_income "A =  Family, B= Strangers * $\Delta$ Income "

label var astrange_bkatiya_income "A =  Strangers, B=Katiya * $\Delta$ Income "
label var astrange_bfamily_income "A =  Strangers, B= Family * $\Delta$ Income "
label var astrange_bstrange_income "A =  Strangers, B= Strangers * $\Delta$ Income "

label var akatiya_bfamily_dalit "A = Katiya, B= Family * Dalit"
label var akatiya_bstrange_dalit "A = Katiya, B= Strangers * Dalit "

label var afamily_bkatiya_dalit "A =  Family, B=Katiya * Dalit "
label var afamily_bfamily_dalit "A =  Family, B= Family * Dalit "
label var afamily_bstrange_dalit "A =  Family, B= Strangers * Dalit "

label var astrange_bkatiya_dalit "A =  Strangers, B=Katiya * Dalit "
label var astrange_bfamily_dalit "A =  Strangers, B= Family * Dalit "
label var astrange_bstrange_dalit "A =  Strangers, B= Strangers * Dalit "

label var akatiya_bfamily_religion "A = Katiya, B= Family * Rel. Sim."
label var akatiya_bstrange_religion "A = Katiya, B= Strangers * Rel. Sim. "

label var afamily_bkatiya_religion "A =  Family, B=Katiya * Rel. Sim. "
label var afamily_bfamily_religion "A =  Family, B= Family * Rel. Sim. "
label var afamily_bstrange_religion "A =  Family, B= Strangers * Rel. Sim. "

label var astrange_bkatiya_religion "A =  Strangers, B=Katiya * Rel. Sim. "
label var astrange_bfamily_religion "A =  Strangers, B= Family * Rel. Sim. "
label var astrange_bstrange_religion "A =  Strangers, B= Strangers * Rel. Sim. "


***TABLE 2***
reg a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19



***TABLE 3***
reg punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
estimates store m21l
ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
estimates store m22l
ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu unaccept_act##resp_katiya s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
estimates store m23l



***FIGURE 3***
reg a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
parmest, saving(estimates1.dta, replace) 
preserve 
use estimates1.dta, clear
drop in 19/28
drop in 17
drop in 15
gen numvar = .
replace numvar = _n
label var numvar "Variable"
label define numvar_label 1 "Income: -9" 2 "Income: -6" 3 "Income: -3" 4 "Income: +3" 5 "Income: +6" 6 "Income: +9" 7 "Hours: -16" 8 "Hours: -12" 9 "Hours: -8" 10 "Hours: -4" 11 "Hours: +4" 12 "Hours: +8" 13 "Hours: +12" 14 "Hours: +16" 15 "A Dalit" 16 "Rel. Sim. of A"
label values numvar numvar_label
twoway rcap max95 min95 numvar if numvar < 7 & numvar > 0, yline(0) graphregion(fcolor(white)) lstyle(solid) lwidth(thick) lcolor(eltblue) ||   ///
rcap max95 min95 numvar if numvar > 6 & numvar < 15, legend(off) ytitle("Coefficient with 95% CI") xtitle("") scale(0.8) lstyle(solid) lwidth(thick) lcolor(red) xlabel(1/16, valuelabels angle(vertical))||   ///
rcap max95 min95 numvar if numvar > 14 & numvar < 17, lstyle(solid) lwidth(thick) lcolor(gold) ||   ///
       scatter estimate numvar, msize(large) mstyle(p1) msymbol(symbolstyle) mfcolor(white) mlcolor(black) ysc(r(-0.2 0.2)) ytick(-0.2(0.05)0.2) ylabel(-0.2(0.05)0.2)
restore

*main results acceptability - Ordered Logit
ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
parmest, saving(estimates2.dta, replace) 
preserve 
use estimates2.dta, clear
drop in 19/29
drop in 17
drop in 15
gen numvar = .
replace numvar = _n
label var numvar "Variable"
label define numvar_label 1 "Income: -9" 2 "Income: -6" 3 "Income: -3" 4 "Income: +3" 5 "Income: +6" 6 "Income: +9" 7 "Hours: -16" 8 "Hours: -12" 9 "Hours: -8" 10 "Hours: -4" 11 "Hours: +4" 12 "Hours: +8" 13 "Hours: +12" 14 "Hours: +16" 15 "A Dalit" 16 "Rel. Sim. of A"
label values numvar numvar_label
twoway rcap max95 min95 numvar if numvar < 7 & numvar > 0, yline(0) graphregion(fcolor(white)) lstyle(solid) lwidth(thick) lcolor(eltblue) ||   ///
rcap max95 min95 numvar if numvar > 6 & numvar < 15, legend(off) ytitle("Coefficient with 95% CI") xtitle("") scale(0.8) lstyle(solid) lwidth(thick) lcolor(red) xlabel(1/16, valuelabels angle(vertical))||   ///
rcap max95 min95 numvar if numvar > 14 & numvar < 17, lstyle(solid) lwidth(thick) lcolor(gold) ||   ///
       scatter estimate numvar, msize(large) mstyle(p1) msymbol(symbolstyle) mfcolor(white) mlcolor(black) ysc(r(-1 1)) ytick(-1(0.2)1) ylabel(-1(0.2)1)
restore

***FIGURE 4***
preserve
gen order = _n
*drop if order > 21
ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(elec_diff2=(-16(4)16)) predict(outcome(0)) atmeans post coeflegend
matrix rV = r(V)
gen coef1 = _b[1bn._at]
gen se1 = sqrt(rV[1,1])
replace coef1 = _b[2._at] if order==2
replace se1 = sqrt(rV[2,2]) if order==2
replace coef1 = _b[3._at] if order==3
replace se1 = sqrt(rV[3,3]) if order==3
replace coef1 = _b[4._at] if order==4
replace se1 = sqrt(rV[4,4]) if order==4
replace coef1 = _b[5._at] if order==5
replace se1 = sqrt(rV[5,5]) if order==5
replace coef1 = _b[6._at] if order==6
replace se1 = sqrt(rV[6,6]) if order==6
replace coef1 = _b[7._at] if order==7
replace se1 = sqrt(rV[7,7]) if order==7
replace coef1 = _b[8._at] if order==8
replace se1 = sqrt(rV[8,8]) if order==8
replace coef1 = _b[9._at] if order==9
replace se1 = sqrt(rV[9,9]) if order==9
gen cihigh1 = coef1+(1.96*se1)
gen cilow1 = coef1-(1.96*se1)

ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(elec_diff2=(-16(4)16)) predict(outcome(0.5)) atmeans post coeflegend
matrix rV = r(V)
gen coef2 = _b[1bn._at]
gen se2 = sqrt(rV[1,1])
replace coef2 = _b[2._at] if order==2
replace se2 = sqrt(rV[2,2]) if order==2
replace coef2 = _b[3._at] if order==3
replace se2 = sqrt(rV[3,3]) if order==3
replace coef2 = _b[4._at] if order==4
replace se2 = sqrt(rV[4,4]) if order==4
replace coef2 = _b[5._at] if order==5
replace se2 = sqrt(rV[5,5]) if order==5
replace coef2 = _b[6._at] if order==6
replace se2 = sqrt(rV[6,6]) if order==6
replace coef2 = _b[7._at] if order==7
replace se2 = sqrt(rV[7,7]) if order==7
replace coef2 = _b[8._at] if order==8
replace se2 = sqrt(rV[8,8]) if order==8
replace coef2 = _b[9._at] if order==9
replace se2 = sqrt(rV[9,9]) if order==9
gen cihigh2 = coef2+(1.96*se2)
gen cilow2 = coef2-(1.96*se2)

ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(elec_diff2=(-16(4)16)) predict(outcome(1)) atmeans post coeflegend
matrix rV = r(V)
gen coef3 = _b[1bn._at]
gen se3 = sqrt(rV[1,1])
replace coef3 = _b[2._at] if order==2
replace se3 = sqrt(rV[2,2]) if order==2
replace coef3 = _b[3._at] if order==3
replace se3 = sqrt(rV[3,3]) if order==3
replace coef3 = _b[4._at] if order==4
replace se3 = sqrt(rV[4,4]) if order==4
replace coef3 = _b[5._at] if order==5
replace se3 = sqrt(rV[5,5]) if order==5
replace coef3 = _b[6._at] if order==6
replace se3 = sqrt(rV[6,6]) if order==6
replace coef3 = _b[7._at] if order==7
replace se3 = sqrt(rV[7,7]) if order==7
replace coef3 = _b[8._at] if order==8
replace se3 = sqrt(rV[8,8]) if order==8
replace coef3 = _b[9._at] if order==9
replace se3 = sqrt(rV[9,9]) if order==9
gen cihigh3 = coef3+(1.96*se3)
gen cilow3 = coef3-(1.96*se3)

keep order coef1 coef2 coef3 cihigh1 cilow1 cihigh2 cilow2 cihigh3 cilow3
gen x = -16
replace x = -12 if order==2
replace x = -8 if order==3
replace x = -4 if order==4
replace x = 0 if order==5
replace x = 4 if order==6
replace x = 8 if order==7
replace x = 12 if order==8
replace x = 16 if order==9
drop if order > 9
twoway (line coef1 x, lcolor(blue)) ///
||  (line coef2 x, lcolor(green)) ///
||  (line coef3 x, lcolor(red)) ///
||  (rcap cihigh1 cilow1 x, lcolor(blue)) ///
||  (rcap cihigh2 cilow2 x, lcolor(green)) ///
||  (rcap cihigh3 cilow3 x, lcolor(red)) ///
, ytitle(Predicted Probabilities) ytick(0(0.1)1) ylabel(0(0.1)1) xtick(-16(4)16) xlabel(-16(4)16) xtitle("Difference in Hours of Electricity (Person B - Person A)") graphregion(fcolor(white)) legend(order(1 "Person B More Acceptable" 2 "A and B About Equal" 3 "Person A More Acceptable"))
restore


preserve
gen order = _n
*drop if order > 21
ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(income_diff2=(-9(3)9)) predict(outcome(0)) atmeans post coeflegend
matrix rV = r(V)
gen coef1 = _b[1bn._at]
gen se1 = sqrt(rV[1,1])
replace coef1 = _b[2._at] if order==2
replace se1 = sqrt(rV[2,2]) if order==2
replace coef1 = _b[3._at] if order==3
replace se1 = sqrt(rV[3,3]) if order==3
replace coef1 = _b[4._at] if order==4
replace se1 = sqrt(rV[4,4]) if order==4
replace coef1 = _b[5._at] if order==5
replace se1 = sqrt(rV[5,5]) if order==5
replace coef1 = _b[6._at] if order==6
replace se1 = sqrt(rV[6,6]) if order==6
replace coef1 = _b[7._at] if order==7
replace se1 = sqrt(rV[7,7]) if order==7
gen cihigh1 = coef1+(1.96*se1)
gen cilow1 = coef1-(1.96*se1)

ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(income_diff2=(-9(3)9)) predict(outcome(0.5)) atmeans post coeflegend
matrix rV = r(V)
gen coef2 = _b[1bn._at]
gen se2 = sqrt(rV[1,1])
replace coef2 = _b[2._at] if order==2
replace se2 = sqrt(rV[2,2]) if order==2
replace coef2 = _b[3._at] if order==3
replace se2 = sqrt(rV[3,3]) if order==3
replace coef2 = _b[4._at] if order==4
replace se2 = sqrt(rV[4,4]) if order==4
replace coef2 = _b[5._at] if order==5
replace se2 = sqrt(rV[5,5]) if order==5
replace coef2 = _b[6._at] if order==6
replace se2 = sqrt(rV[6,6]) if order==6
replace coef2 = _b[7._at] if order==7
replace se2 = sqrt(rV[7,7]) if order==7
gen cihigh2 = coef2+(1.96*se2)
gen cilow2 = coef2-(1.96*se2)

ologit a_accept income_diff2 elec_diff2 a_dalit religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
margins, at(income_diff2=(-9(3)9)) predict(outcome(1)) atmeans post coeflegend
matrix rV = r(V)
gen coef3 = _b[1bn._at]
gen se3 = sqrt(rV[1,1])
replace coef3 = _b[2._at] if order==2
replace se3 = sqrt(rV[2,2]) if order==2
replace coef3 = _b[3._at] if order==3
replace se3 = sqrt(rV[3,3]) if order==3
replace coef3 = _b[4._at] if order==4
replace se3 = sqrt(rV[4,4]) if order==4
replace coef3 = _b[5._at] if order==5
replace se3 = sqrt(rV[5,5]) if order==5
replace coef3 = _b[6._at] if order==6
replace se3 = sqrt(rV[6,6]) if order==6
replace coef3 = _b[7._at] if order==7
replace se3 = sqrt(rV[7,7]) if order==7
gen cihigh3 = coef3+(1.96*se3)
gen cilow3 = coef3-(1.96*se3)

keep order coef1 coef2 coef3 cihigh1 cilow1 cihigh2 cilow2 cihigh3 cilow3
gen x = -9
replace x = -6 if order==2
replace x = -3 if order==3
replace x = 0 if order==4
replace x = 3 if order==5
replace x = 6 if order==6
replace x = 9 if order==7
drop if order > 7
twoway (line coef1 x, lcolor(blue)) ///
||  (line coef2 x, lcolor(green)) ///
||  (line coef3 x, lcolor(red)) ///
||  (rcap cihigh1 cilow1 x, lcolor(blue)) ///
||  (rcap cihigh2 cilow2 x, lcolor(green)) ///
||  (rcap cihigh3 cilow3 x, lcolor(red)) ///
, ytitle(Predicted Probabilities) ytick(0(0.1)1) ylabel(0(0.1)1) xtick(-9(3)9) xlabel(-9 "-9,000" -6 "-6,000" -3 "-3,000" 0 "0" 3 "3,000" 6 "-6,000" 9 "9,000") xtitle("Difference in Income (Person B - Person A)") graphregion(fcolor(white)) legend(order(1 "Person B More Acceptable" 2 "A and B About Equal"3 "Person A More Acceptable"))
restore


***TABLE A1***
preserve
gen hindu = 0
gen muslim = 0
replace hindu = 1 if s2_207 == 1
replace muslim = 1 if s2_207 ==2

gen dalit = 0
replace dalit = 1 if s2_208 == "C"

gen edu_5 = 0
replace edu_5 = 1 if s2_209 <= 5
gen edu_10 = 0
replace edu_10 = 1 if s2_209 >5 & s2_209 <= 10
gen edu_high =0
replace edu_high = 1 if s2_209 >10


la var s2_201 "Male Respondents (proportion)"
la var s2_203 "Age"
la var s2_204 "Household size"
la var hindu "Hindu (proportion)"	
la var muslim "Muslim (proportion)"
la var dalit "Scheduled Caste (proportion)"
la var edu_5 "5 years of schooling or less"
la var edu_10 "6-10 years of schooling"
la var edu_high "More than 10 years of schooling"
la var s2_211 "Ration card"
la var s2_212 "Household spending (Rupees)"
la var s3_301 "Electrified"
la var s3_302_a "Hours of electricity supply"
la var s8_806 "Acceptability of katiya (out of 5)"
la var s8_807 "Punishiment for katiya user (severity, out of 7)"
la var s8_808 "Punishment for katiyamen (severity, out of 5)"

replace s8_807 = . if s8_807 == 999999
replace s8_808 = . if s8_808 == 999999

sutex s2_201 s2_203 s2_204 hindu muslim dalit edu_5 edu_10 edu_high s2_211 s2_212 s3_301 s3_302_a s8_806 s8_807 s8_808 , minmax
restore

***TABLE A2***

sutex ac* ar* ai* ae* a_katiya a_family a_strange, minmax


***TABLE A3***
sutex bc* br* bi* be* b_katiya b_family b_strange, minmax


***TABLE A4***
sutex a_accept b_accept punish, minmax 

***TABLE A5***
preserve
gen hindu = 0
gen muslim = 0
replace hindu = 1 if s2_207 == 1
replace muslim = 1 if s2_207 ==2

gen dalit = 0
replace dalit = 1 if s2_208 == "C"

gen edu_5 = 0
replace edu_5 = 1 if s2_209 <= 5
gen edu_10 = 0
replace edu_10 = 1 if s2_209 >5 & s2_209 <= 10
gen edu_high =0
replace edu_high = 1 if s2_209 >10


la var s2_201 "Male Respondents (proportion)"
la var s2_203 "Age"
la var s2_204 "Household size"
la var hindu "Hindu (proportion)"	
la var muslim "Muslim (proportion)"
la var dalit "Scheduled Caste (proportion)"
la var edu_5 "5 years of schooling or less"
la var edu_10 "6-10 years of schooling"
la var edu_high "More than 10 years of schooling"
la var s2_211 "Ration card"
la var s2_212 "Household spending (Rupees)"
la var s3_301 "Electrified"
la var s3_302_a "Hours of electricity supply"
la var s8_806 "Acceptability of katiya (out of 5)"
la var s8_807 "Punishiment for katiya user (severity, out of 7)"
la var s8_808 "Punishment for katiyamen (severity, out of 5)"

replace s8_807 = . if s8_807 == 999999
replace s8_808 = . if s8_808 == 999999

la var s2_201 "Male"
la var s2_203 "Age"
la var s2_204 "Household size"
la var hindu "Hindu"	
la var muslim "Muslim"
la var dalit "Scheduled Caste"
la var s2_209 "Education"
la var s2_211 "Ration card"
la var s2_212 "Household spending"
la var s3_302_a "Hours of electricity supply"
la var s8_806 "Acceptability of katiya"
la var s8_807 "Punishiment for katiya user"
la var s8_808 "Punishment for katiyamen"
pwcorr s2_203 s2_204 hindu dalit s2_209 s2_211 s2_212 s3_302_a s8_806 s8_807 s8_808
restore

***TABLE A6***
preserve
*Looking at scenario type and their effects ONLY katiya vs katiya
keep if scen_type == 1
reg a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18a
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19a
restore



***TABLE A7***
preserve
*Looking at scenario type and their effects 
drop if scen_type == 2
drop if scen_type == 3
drop if scen_type == 8
drop if scen_type == 9
reg a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18b
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19b
restore


***TABLE A8***
preserve
keep if scen_type == 4 | scen_type == 5 |scen_type == 6 |scen_type == 7
*Looking at scenario type and their effects -- add a_katiya interaction
reg a_accept a_katiya##c.income_diff2 a_katiya##c.elec_diff2 a_katiya##i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18d
ologit a_accept a_katiya##c.income_diff2 a_katiya##c.elec_diff2 a_katiya##i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19d
restore


***TABLE A9***
*Looking at Activity Dimensions & Interactions
eststo: ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a akatiya_bfamily-astrange_bstrange, vce(clu s1_106)
estimates store m31
eststo: ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a akatiya_bfamily-astrange_bstrange akatiya_bfamily_income akatiya_bstrange_income afamily_bkatiya_income afamily_bfamily_income afamily_bstrange_income astrange_bkatiya_income astrange_bfamily_income astrange_bstrange_income, vce(clu s1_106)
estimates store m32
*ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a akatiya_bfamily-astrange_bstrange akatiya_bfamily_elec akatiya_bstrange_elec afamily_bkatiya_elec afamily_bfamily_elec afamily_bstrange_elec astrange_bkatiya_elec astrange_bfamily_elec astrange_bstrange_elec, vce(clu s1_106)
*estimates store m33
eststo: ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a akatiya_bfamily-astrange_bstrange akatiya_bfamily_dalit akatiya_bstrange_dalit afamily_bkatiya_dalit afamily_bfamily_dalit afamily_bstrange_dalit astrange_bkatiya_dalit astrange_bfamily_dalit astrange_bstrange_dalit, vce(clu s1_106)
estimates store m33
eststo: ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a akatiya_bfamily-astrange_bstrange akatiya_bfamily_religion akatiya_bstrange_religion afamily_bkatiya_religion afamily_bfamily_religion afamily_bstrange_religion astrange_bkatiya_religion astrange_bfamily_religion astrange_bstrange_religion, vce(clu s1_106)
estimates store m34
eststo clear

***TABLE A10***
preserve
drop if scenario == 601
*Looking at scenario type and their effects
reg a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18e
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19e
ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_strange##a_katiya##b_strange##b_katiya, vce(clu s1_106)
estimates store m20e
restore

***TABLE A11***
preserve
keep if scenario == 601
*Looking at scenario type and their effects
reg a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m18f
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m19f
ologit a_accept  income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_strange##a_katiya##b_strange##b_katiya, vce(clu s1_106)
estimates store m20f
restore


***TABLE A12***

*Looking at scenario type and their effects
reg punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m21
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m22
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_acc_bin##a_katiya a_acc_bin##a_strange b_acc_bin##b_katiya b_acc_bin##b_strange, vce(clu s1_106)
estimates store m23


***TABLE A13***
*Looking at scenario type and their effects
reg punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m31
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m32
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_acc_bin##a_katiya a_acc_bin##a_strange b_acc_bin##b_katiya b_acc_bin##b_strange, vce(clu s1_106)
estimates store m33

***TABLE A14***
preserve
drop if scenario == 601
*Looking at scenario type and their effects
reg punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m21b
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m22b
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_acc_bin##a_katiya a_acc_bin##a_strange b_acc_bin##b_katiya b_acc_bin##b_strange, vce(clu s1_106)
estimates store m23b
restore

***TABLE A15***
preserve
keep if scenario == 601
*Looking at scenario type and their effects
reg punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m21a
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m22a
ologit punish abs_income_diff2 abs_elec_diff2 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a a_acc_bin##a_katiya a_acc_bin##a_strange b_acc_bin##b_katiya b_acc_bin##b_strange, vce(clu s1_106)
estimates store m23a
restore


***TABLE A16***
reg a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(r)
    estimates store m1
reg a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu id)
    estimates store m2
reg a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
	estimates store m3

	
***TABLE A17***
*ologit  ordered logit models with odds ratio for interpretationb
ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(r)
*putpdf table mytable4 = etable
    estimates store m4

ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu id)
*putpdf table mytable5 = etable
    estimates store m5

ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
	estimates store m6

***TABLE A18***
*putpdf table mytable6 = etable
ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(r) or
*putpdf table mytable7 = etable
    estimates store m7
ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu id) or
*putpdf table mytable8 = etable
    estimates store m8
ologit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106) or
*putpdf table mytable9 = etable
    estimates store m9
*putpdf save myreport.pdf, replace

***TABLE A19***
preserve
drop if a_accept == 0.5
logit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(r)
estimates store m13
logit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu id)
estimates store m14
logit a_accept i2diff1-i2diff3 i2diff5-i2diff7 e2diff1-e2diff4 e2diff6-e2diff9 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m15
restore

***TABLE A20***
reg punish ab_i2diff2-ab_i2diff4 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(r)
    estimates store m10
reg punish ab_i2diff2-ab_i2diff4 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu id)
    estimates store m11
reg punish ab_i2diff2-ab_i2diff4 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
    estimates store m12


	***TABLE A21***
ologit a_accept income_diff2 elec_diff2 i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m24
ologit a_accept income_diff elec_diff i.a_dalit i.religion_sim_a s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m25
ologit punish abs_income_diff2 abs_elec_diff2 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m26
ologit punish abs_income_diff abs_elec_diff ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
estimates store m27

***TABLE A22***
preserve
use theft_sec6_long, clear
drop if a_accept == 0.5
*drop unsure ones

gen id2 = real(string(id) + string(scenario))
label var id2 "Resp. x Scen"
*all unique IDs now
*expand each one into A and B alternatives 
rename a_caste castec1
rename a_religion religionc1
rename a_activity activityc1
rename a_income incomec1
rename a_elec elecc1
rename b_caste castec2
rename b_religion religionc2
rename b_activity activityc2
rename b_income incomec2
rename b_elec elecc2
/*
gen actc1 = "C"
replace actc1 = "A" if activityc1 ==1
replace actc1 = "B" if activityc1 ==2 | activityc1==3

gen actc2 = "C"
replace actc2 = "A" if activityc2 ==1
replace actc2 = "B" if activityc2 ==2 | activityc2==3

*/
reshape long castec religionc actc incomec elecc, i(id2) j(person)
replace incomec = incomec/1000
*tab actc, gen(act)


*now we have a dataset of both A and B persons per case
gen choice = 0 
replace choice = 1 if person == 1 & a_accept == 1
replace choice = 1 if person == 2 & a_accept == 0

label var choice "Choice of Person"
label var castec "Caste"
label var religionc "Religion"
*label var activityc "Activity"
label var incomec "Income (1000s Rs)"
label var elecc "Hours of Electr."
label var person "Person Chosen"
/***

\noindent
Table~\ref{tablea7} displays the alternative-specific mix logit model of choosing between Person A and B given their characteristics.

***/
texdoc stlog, nolog
*here we assume pref over income and acceptability stay constant over the pop, but electricity vary from person to person.
asmixlogit choice incomec, case(id2) alternatives(person) random(elecc)
estimates store m16

*Income and hours are of interest; pref over religion and caste varies in the population
asmixlogit choice incomec elecc, case(id2) alternatives(person) random(i.castec)
estimates store m17
restore




***TABLE A24***

preserve 
xtset id
*Looking at scenario type and their effects
xtreg a_accept income_diff2 elec_diff2 a_dalit##resp_dalit i.religion_sim_a, fe vce(clu s1_106)
estimates store m18g
xtologit a_accept income_diff2 elec_diff2 a_dalit##resp_dalit i.religion_sim_a, vce(clu s1_106)
estimates store m19g
restore 


***TABLE A25***
preserve
xtset id
*Looking at scenario type and their effects
xtreg punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu, fe vce(clu s1_106)
estimates store m21f
xtologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu, vce(clu s1_106)
estimates store m22f
xtologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu unaccept_act##resp_katiya, vce(clu s1_106)
estimates store m23f
restore

***TABLES A23, A26-A28***
preserve
gen dalit = 0
replace dalit = 1 if s2_208 == "C" 
*Only include SC in this def. ST = 2.6% excluded

gen katiya = 0 
replace katiya = 1 if s8_802 == 1

gen lnincome = log(s2_212)

gen hindu = 0 
replace hindu =1 if s2_207 == 1

replace s3_309_c = . if s3_309_c==6

la var s8_806 "Acceptability"
la var s8_807 "Punishment"
la var dalit "Dalit Caste"
la var s2_209 "Education"
la var katiya "Katiya"
la var lnincome "Log Income"
la var hindu "Hindu"
la var s3_309_c "On time payment"
la var s3_310 "Elec. Satisfaction"
la var s3_302_a "Supply Hours"

*TABLE A23* 

reg s8_806 dalit s2_209 katiya lnincome hindu, vce(clu s1_106)
    estimates store m1
reg s8_806 dalit s2_209 katiya lnincome hindu s3_302_a, vce(clu s1_106)
    estimates store m2
reg s8_806 dalit s2_209 katiya lnincome hindu s3_309_c s3_310 s3_302_a, vce(clu s1_106)
	estimates store m3

		
	
*TABLE A26* 	
*texdoc stlog close
*texdoc write \input{../Analysis/Tables/tablen1.tex}
ologit s8_806 dalit s2_209 katiya lnincome hindu, vce(clu s1_106)
    estimates store m1
ologit s8_806 dalit s2_209 katiya lnincome hindu s3_302_a, vce(clu s1_106)
    estimates store m2
ologit s8_806 dalit s2_209 katiya lnincome hindu s3_309_c s3_310 s3_302_a, vce(clu s1_106)
	estimates store m3
		
		
*TABLE A27* 
		
*qualitatively similar results
*add punishment!
replace s8_807 = . if s8_807 == 999999

reg s8_807 dalit s2_209 katiya lnincome hindu, vce(clu s1_106)
    estimates store m1
reg s8_807 dalit s2_209 katiya lnincome hindu s3_302_a, vce(clu s1_106)
    estimates store m2
reg s8_807 dalit s2_209 katiya lnincome hindu s3_309_c s3_310 s3_302_a, vce(clu s1_106)
	estimates store m3

		
		
*TABLE A28* 
		
*texdoc stlog close
*texdoc write \input{../Analysis/Tables/tablen1.tex}
ologit s8_807 dalit s2_209 katiya lnincome hindu, vce(clu s1_106)
    estimates store m1
ologit s8_807 dalit s2_209 katiya lnincome hindu s3_302_a, vce(clu s1_106)
    estimates store m2
ologit s8_807 dalit s2_209 katiya lnincome hindu s3_309_c s3_310 s3_302_a, vce(clu s1_106)
	estimates store m3
restore


***TABLE A29***
*Balance Tests*
eststo clear
label var s2_201 "Female"
label var s2_203 "Age"

gen ahindu_bmuslim = 0
replace ahindu_bmuslim = 1 if ar2==1 & br3==1
gen ahindu_bhindu = 0
replace ahindu_bhindu = 1 if ar2==1 & br2==1
gen amuslim_bmuslim = 0
replace amuslim_bmuslim = 1 if ar3==1 & br3==1
gen amuslim_bhindu = 0
replace amuslim_bhindu = 1 if ar3==1 & br2==1

gen ahindu_bblank = 0
replace ahindu_bblank = 1 if ar2==1 & br1==1
gen amuslim_bblank = 0
replace amuslim_bblank = 1 if ar3==1 & br1==1

gen ablank_bhindu = 0
replace ablank_bhindu = 1 if ar1==1 & br2==1
gen ablank_bmuslim = 0
replace ablank_bmuslim = 1 if ar1==1 & br3==1

label var amuslim_bhindu "A=Muslim, B=Hindu"
label var ahindu_bmuslim "A=Hindu, B=Muslim"
label var ahindu_bhindu "A=Hindu, B=Hindu"
label var amuslim_bmuslim "A=Muslim, B=Muslim"

label var ablank_bhindu "A=BLANK, B=Hindu"
label var ablank_bmuslim "A=BLANK, B=Muslim"
label var ahindu_bblank "A=Hindu, B=BLANK"
label var amuslim_bblank "A=Muslim, B=BLANK"

gen adalit_bdalit = 0
replace adalit_bdalit = 1 if ac2==1 & bc2==1
gen ablank_bdalit = 0
replace ablank_bdalit = 1 if ac1==1 & bc2==1
gen adalit_bblank = 0
replace adalit_bblank = 1 if ac2==1 & bc1==1

label var adalit_bblank "A=Dalit, B=BLANK"
label var adalit_bdalit "A=Dalit, B=Dalit"
label var ablank_bdalit "A=BLANK, B=Dalit"

*s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a
*Gender
eststo: reg s2_201 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Age
eststo: reg s2_203 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Education
eststo: reg s2_209 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Spending
eststo: reg income_resp income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Ration Card
eststo: reg s2_211 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Electrified
eststo: reg s3_301 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Caste
eststo: reg resp_dalit income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Religion
eststo: reg resp_hindu income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
*Urban/Rural
eststo: reg urban2 income_diff2 elec_diff2 adalit_bblank adalit_bdalit ablank_bdalit amuslim_bhindu ahindu_bmuslim ahindu_bhindu amuslim_bmuslim ablank_bhindu ablank_bmuslim ahindu_bblank amuslim_bblank, vce(clu s1_106)
eststo clear

***TABLE A30***

preserve
clear
import delimited "NSS.csv"

gen hindu = 0
replace hindu = 1 if religion=="Hinduism"
replace age = "." if age=="NA"
destring age, replace
gen sc = 0
replace sc = 1 if socialgroup=="Scheduled Castes"
replace sc = 1 if socialgroup=="Scheduled Tribes"



sum age
sum hindu
sum male
sum sc

replace mpce_30days = "." if mpce_30days=="NA"
destring mpce_30days, replace

replace hhsize = "." if hhsize=="NA"
destring hhsize, replace

gen educ = .
replace educ = 1 if education==1
replace educ = 1 if education==2
replace educ = 1 if education==3
replace educ = 1 if education==4
replace educ = 1 if education==5
replace educ = 2 if education==6
replace educ = 2 if education==7
replace educ = 3 if education==8
replace educ = 4 if education==9
replace educ = 5 if education==10
replace educ = 6 if education==11
replace educ = 6 if education==12

gen educdum6 = 0
replace educdum6 = 1 if education==11
replace educdum6 = 1 if education==12


svyset hhid [pweight=mlt], strata(stratum)
svy: mean hindu if urban==1
svy: mean sc if urban==1
svy: mean age if urban==1
svy: mean male if urban==1
svy: mean mpce_30days if urban==1
svy: mean hhsize if urban==1
svy: mean education if urban==1
svy: mean educdum6 if urban==1
svy: mean elec if urban==1

svy: mean hindu if urban==0
svy: mean sc if urban==0
svy: mean age if urban==0
svy: mean male if urban==0
svy: mean mpce_30days if urban==0
svy: mean hhsize if urban==0
svy: mean education if urban==0
svy: mean educdum6 if urban==0
svy: mean elec if urban==0
restore


***FIGURE A1***
hist s8_806, d percent 

***FIGURE A2***

hist s8_807, d percent

***FIGURE A3***
reg punish ab_i2diff2-ab_i2diff4 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
parmest, saving(estimates3.dta, replace) 
preserve 
use estimates3.dta, clear
drop in 45
drop in 36/40
drop in 30/34
drop in 24/28
drop in 16/22
drop in 8/14

gen numvar = .
replace numvar = _n
label var numvar "Variable"
label define numvar_label 1 "Income diff: 3" 2 "Income diff: 6" 3 "Income diff: 9" 4 "Hours diff: 4" 5 "Hours diff: 8" 6 "Hours diff: 12" 7 "Hours diff: 16"  8 "A Dalit and Less Acceptable" 9 "B Dalit and Less Acceptable" 10 "A Less Acceptable and Rel. Sim" 11 "B Less Acceptable and Rel. Sim" 12 "Electrified" 13 "Resp. Dalit" 14 "Resp. Hindu" 15 "Trust"
label values numvar numvar_label
twoway rcap max95 min95 numvar if numvar < 4 & numvar > 0, yline(0) graphregion(fcolor(white)) lstyle(solid) lwidth(thick) lcolor(eltblue) ||   ///
rcap max95 min95 numvar if numvar > 3 & numvar < 9, legend(off) ytitle("Coefficient with 95% CI") xtitle("") scale(0.8) lstyle(solid) lwidth(thick) lcolor(red) xlabel(1/15, valuelabels angle(vertical))||   ///
rcap max95 min95 numvar if numvar > 8 & numvar < 16, lstyle(solid) lwidth(thick) lcolor(gold) ||   ///
       scatter estimate numvar, msize(large) mstyle(p1) msymbol(symbolstyle) mfcolor(white) mlcolor(black) ysc(r(-0.2 0.2)) ytick(-0.2(0.05)0.2) ylabel(-0.2(0.05)0.2)
restore

*main results punishment - Ordered Logit
ologit punish ab_i2diff2-ab_i2diff4 ab_e2diff2-ab_e2diff5 a_acc_bin##a_dalit b_acc_bin##b_dalit a_acc_bin##religion_sim_a b_acc_bin##religion_sim_b s2_209 income_resp urban2 s3_301 s2_211 s3_302_a resp_dalit resp_hindu s5_501_a, vce(clu s1_106)
parmest, saving(estimates4.dta, replace) 
preserve 
use estimates4.dta, clear
drop in 45/47
drop in 38/40
drop in 36
drop in 30/34
drop in 24/28
drop in 16/22
drop in 8/14

gen numvar = .
replace numvar = _n
label var numvar "Variable"
label define numvar_label 1 "Income diff: 3" 2 "Income diff: 6" 3 "Income diff: 9" 4 "Hours diff: 4" 5 "Hours diff: 8" 6 "Hours diff: 12" 7 "Hours diff: 16"  8 "A Dalit and Less Acceptable" 9 "B Dalit and Less Acceptable" 10 "A Less Acceptable and Rel. Sim" 11 "B Less Acceptable and Rel. Sim" 12 "Resp. Income" 13 "Electrified" 14 "Resp. Dalit" 15 "Resp. Hindu" 16 "Trust"
label values numvar numvar_label
twoway rcap max95 min95 numvar if numvar < 4 & numvar > 0, yline(0) graphregion(fcolor(white)) lstyle(solid) lwidth(thick) lcolor(eltblue) ||   ///
rcap max95 min95 numvar if numvar > 3 & numvar < 9, legend(off) ytitle("Coefficient with 95% CI") xtitle("") scale(0.8) lstyle(solid) lwidth(thick) lcolor(red) xlabel(1/16, valuelabels angle(vertical))||   ///
rcap max95 min95 numvar if numvar > 8 & numvar < 17, lstyle(solid) lwidth(thick) lcolor(gold) ||   ///
       scatter estimate numvar, msize(large) mstyle(p1) msymbol(symbolstyle) mfcolor(white) mlcolor(black) ysc(r(-0.5 0.5)) ytick(-0.5(0.1)0.5) ylabel(-0.5(0.1)0.5)
restore


***FIGURE A4***


preserve
gen order = _n
*drop if order > 21
ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_i=(3000(3000)12000)) predict(outcome(1)) atmeans post coeflegend
matrix rV = r(V)
gen coef1 = _b[1bn._at]
gen se1 = sqrt(rV[1,1])
replace coef1 = _b[2._at] if order==2
replace se1 = sqrt(rV[2,2]) if order==2
replace coef1 = _b[3._at] if order==3
replace se1 = sqrt(rV[3,3]) if order==3
replace coef1 = _b[4._at] if order==4
replace se1 = sqrt(rV[4,4]) if order==4
gen cihigh1 = coef1+(1.96*se1)
gen cilow1 = coef1-(1.96*se1)

ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_i=(3000(3000)12000)) predict(outcome(2)) atmeans post coeflegend
matrix rV = r(V)
gen coef2 = _b[1bn._at]
gen se2 = sqrt(rV[1,1])
replace coef2 = _b[2._at] if order==2
replace se2 = sqrt(rV[2,2]) if order==2
replace coef2 = _b[3._at] if order==3
replace se2 = sqrt(rV[3,3]) if order==3
replace coef2 = _b[4._at] if order==4
replace se2 = sqrt(rV[4,4]) if order==4
gen cihigh2 = coef2+(1.96*se2)
gen cilow2 = coef2-(1.96*se2)


ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_i=(3000(3000)12000)) predict(outcome(3)) atmeans post coeflegend
matrix rV = r(V)
gen coef3 = _b[1bn._at]
gen se3 = sqrt(rV[1,1])
replace coef3 = _b[2._at] if order==2
replace se3 = sqrt(rV[2,2]) if order==2
replace coef3 = _b[3._at] if order==3
replace se3 = sqrt(rV[3,3]) if order==3
replace coef3 = _b[4._at] if order==4
replace se3 = sqrt(rV[4,4]) if order==4
gen cihigh3 = coef3+(1.96*se3)
gen cilow3 = coef3-(1.96*se3)

ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_i=(3000(3000)12000)) predict(outcome(4)) atmeans post coeflegend
matrix rV = r(V)
gen coef4 = _b[1bn._at]
gen se4 = sqrt(rV[1,1])
replace coef4 = _b[2._at] if order==2
replace se4 = sqrt(rV[2,2]) if order==2
replace coef4 = _b[3._at] if order==3
replace se4 = sqrt(rV[3,3]) if order==3
replace coef4 = _b[4._at] if order==4
replace se4 = sqrt(rV[4,4]) if order==4
gen cihigh4 = coef4+(1.96*se4)
gen cilow4 = coef4-(1.96*se4)


keep order coef1 coef2 coef3 cihigh1 cilow1 cihigh2 cilow2 cihigh3 cilow3 coef4 se4 cihigh4 cilow4
gen x = 3000
replace x = 6000 if order==2
replace x = 9000 if order==3
replace x = 12000 if order==4
drop if order > 4
twoway (line coef1 x, lcolor(blue)) ///
||  (line coef2 x, lcolor(green)) ///
||  (line coef3 x, lcolor(red)) ///
||  (line coef4 x, lcolor(purple)) ///
||  (rcap cihigh1 cilow1 x, lcolor(blue)) ///
||  (rcap cihigh2 cilow2 x, lcolor(green)) ///
||  (rcap cihigh3 cilow3 x, lcolor(red)) ///
||  (rcap cihigh4 cilow4 x, lcolor(purple)) ///
, ytitle(Predicted Probabilities) ytick(0(0.1)1) ylabel(0(0.1)1) xtick(3000(3000)12000) xlabel(3000(3000)12000) xtitle("Income") graphregion(fcolor(white)) legend(order(1 "No Punishment" 2 "Warning" 3 "Monetary Fine" 4 "Jail Time"))
restore




preserve
gen order = _n
*drop if order > 21
ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_e=(8(4)24)) predict(outcome(1)) atmeans post coeflegend
matrix rV = r(V)
gen coef1 = _b[1bn._at]
gen se1 = sqrt(rV[1,1])
replace coef1 = _b[2._at] if order==2
replace se1 = sqrt(rV[2,2]) if order==2
replace coef1 = _b[3._at] if order==3
replace se1 = sqrt(rV[3,3]) if order==3
replace coef1 = _b[4._at] if order==4
replace se1 = sqrt(rV[4,4]) if order==4
replace coef1 = _b[5._at] if order==5
replace se1 = sqrt(rV[5,5]) if order==5
gen cihigh1 = coef1+(1.96*se1)
gen cilow1 = coef1-(1.96*se1)

ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_e=(8(4)24)) predict(outcome(2)) atmeans post coeflegend
matrix rV = r(V)
gen coef2 = _b[1bn._at]
gen se2 = sqrt(rV[1,1])
replace coef2 = _b[2._at] if order==2
replace se2 = sqrt(rV[2,2]) if order==2
replace coef2 = _b[3._at] if order==3
replace se2 = sqrt(rV[3,3]) if order==3
replace coef2 = _b[4._at] if order==4
replace se2 = sqrt(rV[4,4]) if order==4
replace coef2 = _b[5._at] if order==5
replace se2 = sqrt(rV[5,5]) if order==5
gen cihigh2 = coef2+(1.96*se2)
gen cilow2 = coef2-(1.96*se2)


ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_e=(8(4)24)) predict(outcome(3)) atmeans post coeflegend
matrix rV = r(V)
gen coef3 = _b[1bn._at]
gen se3 = sqrt(rV[1,1])
replace coef3 = _b[2._at] if order==2
replace se3 = sqrt(rV[2,2]) if order==2
replace coef3 = _b[3._at] if order==3
replace se3 = sqrt(rV[3,3]) if order==3
replace coef3 = _b[4._at] if order==4
replace se3 = sqrt(rV[4,4]) if order==4
replace coef3 = _b[5._at] if order==5
replace se3 = sqrt(rV[5,5]) if order==5
gen cihigh3 = coef3+(1.96*se3)
gen cilow3 = coef3-(1.96*se3)

ologit punish unaccept_i unaccept_e unaccept_c##resp_dalit unaccept_rh##resp_hindu s2_209 income_resp urban2 s3_301 s2_211 s3_302_a s5_501_a, vce(clu s1_106)
margins, at(unaccept_i=(8(4)24)) predict(outcome(4)) atmeans post coeflegend
matrix rV = r(V)
gen coef4 = _b[1bn._at]
gen se4 = sqrt(rV[1,1])
replace coef4 = _b[2._at] if order==2
replace se4 = sqrt(rV[2,2]) if order==2
replace coef4 = _b[3._at] if order==3
replace se4 = sqrt(rV[3,3]) if order==3
replace coef4 = _b[4._at] if order==4
replace se4 = sqrt(rV[4,4]) if order==4
replace coef4 = _b[5._at] if order==5
replace se4 = sqrt(rV[5,5]) if order==5
gen cihigh4 = coef4+(1.96*se4)
gen cilow4 = coef4-(1.96*se4)


keep order coef1 coef2 coef3 cihigh1 cilow1 cihigh2 cilow2 cihigh3 cilow3 coef4 se4 cihigh4 cilow4
gen x = 8
replace x = 12 if order==2
replace x = 16 if order==3
replace x = 20 if order==4
replace x = 24 if order==5
drop if order > 5
twoway (line coef1 x, lcolor(blue)) ///
||  (line coef2 x, lcolor(green)) ///
||  (line coef3 x, lcolor(red)) ///
||  (line coef4 x, lcolor(purple)) ///
||  (rcap cihigh1 cilow1 x, lcolor(blue)) ///
||  (rcap cihigh2 cilow2 x, lcolor(green)) ///
||  (rcap cihigh3 cilow3 x, lcolor(red)) ///
||  (rcap cihigh4 cilow4 x, lcolor(purple)) ///
, ytitle(Predicted Probabilities) ytick(0(0.1)1) ylabel(0(0.1)1) xtick(8(4)24) xlabel(8(4)24) xtitle("Hours of Electricity") graphregion(fcolor(white)) legend(order(1 "No Punishment" 2 "Warning" 3 "Monetary Fine" 4 "Jail Time"))
restore
